import express from 'express';
import NoticeboardController from '../controller/noticeboardCtrl.js';

const router = express.Router();

// 获取帖子列表
router.get('/posts/page/:page', NoticeboardController.getList);

// 获取帖子详情
router.get('/posts/:id', NoticeboardController.getById);

// 创建帖子
router.post('/posts', NoticeboardController.create);

// 更新帖子
router.put('/posts/:id', NoticeboardController.update);

// 删除帖子
router.delete('/posts/:id', NoticeboardController.delete);

// 点赞/取消点赞
router.post('/posts/:id/like', NoticeboardController.like);

// 获取帖子评论
router.get('/posts/:id/comments', NoticeboardController.getComments);

// 添加评论
router.post('/posts/:id/comments', NoticeboardController.addComment);

// 删除评论
router.delete('/posts/:postId/comments/:commentId', NoticeboardController.deleteComment);

export default router;